<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<%@include file="/common/taglibs.jsp"%>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>发送短消息</title>
<%@include file="/common/uploadify.jsp"%>
<%@include file="/common/extjs.jsp"%>
<script type="text/javascript" src="${ctx}/scripts/extjs/diy/TreeCheckNodeUI.js"></script>
<script type="text/javascript" src="${ctx}/pages/admin/security/user/selector.js"></script>
<script type="text/javascript" src="${ctx}/scripts/fckeditor/fckeditor.js"></script>
<script type="text/javascript" src="${ctx}/pages/longtian/fileattch/fileattch.js"></script>
<LINK href="${ctx}/styles/style.css" type='text/css' rel='stylesheet'>
<LINK href="${ctx}/pages/longtian/fileattch.css" type='text/css' rel='stylesheet'>
<style type="text/css">
.msgInput{
	border:0px;
	border-bottom: 1px dotted #000;
	width: 690px;
}
</style>
</head>
<body>
<div id="emp_sel_container" class="x-hidden">
    <div class="x-window-header">员工列表</div>
    <div id="emp_grid"></div>
</div>
<br>
<table align="center" width="800" style="border-bottom: 2px solid #99BBE8;">
  <tr><td align="left" style="padding-left: 20px;">
  	<a href="#" onclick="sendMsg()" title="将发送给指定人员" style="color: red; font-weight: bold;">
  	  <img src="${ctx}/images/icons/send.png">&nbsp;立即发送
  	</a>
  	&nbsp;&nbsp;&nbsp;&nbsp;
  	<a href="receiveIndex.do">
  		<img src="${ctx}/images/exticons/arrow-down.gif">&nbsp;收信箱</a>
  	&nbsp;&nbsp;&nbsp;&nbsp;
  	<a href="sendIndex.do">
  	  <img src="${ctx}/images/exticons/arrow-up.gif">&nbsp;发信箱</a>
  </td></tr>
</table>
<form id="sendMsg" action="sendMsg.do" method="post">
<table width="800" align="center" style="line-height:30px;" cellpadding="0" cellspacing="0">
  <tr>
    <td colspan="2" height="10"></td>
  </tr>
  <tr>
    <td width="80" align="right">发送人：</td>
    <td width="720">
    	<input type="text" name="senderName" value="${model.sender.name}" style="color:#2966B0; font-weight: bold;" class="msgInput"/>
    	<s:hidden name="model.sender.id" id="senderId"/>
    </td>
  </tr>
  <tr>
    <td align="right">接收人：</td>
    <td>
    	<s:textfield name="receivers" id="receivers" onclick="showWin()" cssClass="msgInput" readonly="true"/>
    	<s:hidden name="receiverIds" id="receiverIds"/>
    </td>
  </tr>
  <tr>
    <td align="right">主　题：</td>
    <td>
    	<s:textfield name="model.title" id="title" cssClass="msgInput"/>
    </td>
  </tr>
  <tr>
    <td align="right" valign="top">附　件：</td>
    <td valign="top">
  		<input type="file" id="systop_upload"/>&nbsp;注：<b><span style="color:#EB2A03">附加大小在100M以内!</span></b>
   	    <div id="custom"><div id="systop-file-queue"></div></div>
   	    <div id="systop-uploaded-files" style="width:690px; border-bottom: 1px dotted #000;">
   	      <input type="hidden" id="fileattchids" name="fileattchids"/>
 	    </div>
    </td>
  </tr>
  <tr>
    <td align="right" valign="top">内　容：</td>
    <td style="padding-top: 5px;">
      <textarea name="model.content" id="content"></textarea> 
    </td>
  </tr>
  <tr>
    <td colspan="2" height="15"></td>
  </tr>
</table>
</form>
<script type="text/javascript">

function sendMsg(){
	var receiverIds = $("#receiverIds").val();
	var title = $("#title").val();
	var content = $("#content").val();
	if (receiverIds == null || receiverIds.length == 0){
		alert("必须选择收信人!");
		return;
	}
	if (title == null || title.length == 0){
		alert("标题为不能为空!");
		return;
	}
	document.getElementById("sendMsg").submit();
} 

/* -- user select component Start-- */
var emp;
emp = new UserSelector({
    url: '${ctx}/security/user/userTree.do?showPhoneNum=1',
    el: 'emp_sel_container',
    idsEl:'receiverIds',
    textEl:'receivers',
    width : 250,
	height : 450,
	multiSel : true
});

function showWin() {   
	emp.show(true);
}
/* -- user select component End-- */

/* -- FckEdotor Start -- */
function preFckEditor(){
	var fckEditor = new FCKeditor( 'content' ) ;
    fckEditor.BasePath = "${ctx}/scripts/fckeditor/";
    fckEditor.ToolbarSet = 'BasicA';
    fckEditor.Width = 690;
    fckEditor.Height = 320;
    fckEditor.ReplaceTextarea();
}
preFckEditor();
/* -- FckEdotor End -- */

//渲染上传组件
renderUploader();
</script>
</body>
</html>